<?php defined('SYSPATH') or die('No direct script access.') ?>
<table id="table-orders" class="table table-hover">
	<tr>
		<th>#</th>
		<th>название заказа</th>
		<th>кол-во позиций</th>
		<th>стоимость, <span class=rouble>Р</span></th>
		<th>статус</th>
<?php
if ($role['name']=='client')
{
?>
		<th>операции</th>
<?php
}
?>
		</tr>
<?php
foreach ($rows as &$row)
{
?>
	<tr class="alert alert-<?php echo ($row['complete']!='готов'?'danger':'success') ?>">
		<td><?php echo $row['num'] ?></td>
		<td><?php echo HTML::anchor('book/items/'.$row['id'],$row['name']) ?></td>
		<td><?php echo $row['itemscount'] ?></td>
		<td><?php echo $row['cost'] ?> <span class=rouble>Р</span></td>
<?php
if ($role['name']=='client' AND $row['complete']!='готов')
{
?>
		<td><?php echo $row['status'] ?></td>
		<td>
			<button type="button" class="btn btn-default btn-xs" id="order_<?php echo $row['id'] ?>_edit"><span class="glyphicon glyphicon-pencil"></span> Редактировать</button>
  			<button type="button" class="btn btn-default btn-xs" id="order_<?php echo $row['id'] ?>_delete"><span class="glyphicon glyphicon-trash"></span> Удалить</button>
  		</td>
<?php
}
elseif ($role['name']=='client' AND $row['complete']=='готов')
{
?>
		<td><?php echo $row['status'] ?></td>
		<td>Заблокирован</td>
<?php
}
elseif ($role['name']=='admin' OR $role['name']=='performer')
{
?>
		<td><?php echo Form::select('status_orders_'.$row['id'], $enum, $row['status'],array('class'=>'form-control')) ?></td>

<?php
}
?>
	</tr>
<?php
}
?>
</table>